class Attendance < ActiveRecord::Base
  belongs_to :raid
  belongs_to :character
  validates_presence_of :raid, :character
  validates_presence_of :jointime, :leavetime
  #validates_associated :raid  #caused a loop for me.
  validates_each :jointime do |model, attr, value|   
    if value && model.leavetime
      if value > model.leavetime 
        #puts "Didn't like: " + value.to_s + " -- " + model.leavetime.to_s
        model.errors.add(attr, "after leave time.")
      end
    end
  end
  
  
end
